<?php
abstract class URL {
	
	
	/**
	 * Retorna dominio de acordo com parametro passado
	 * Se param = full, retorna o dominio completo 
	 */
	public static function getDomain($param=null){
				
		$url = explode('.', $_SERVER['HTTP_HOST']); 
		$result = ($param != null && $param != 'full') ? $url[$param] : $url;
		if($result == null){$result = $url[0];}
		
		if($param == 'full'){
			$result = '';	
			$len = sizeof($url);
			for($i=1; $i < $len; $i++){
				$result .= $url[$i];
				if($i < ($len-1)){ $result .= '.'; }
			}
		}
		
		return $result; 	
	}
	
	
}
?>